The present invention relates to data communication and processing systems. In such systems, it is often useful to structure the program code executing within a process into so-called "tasks." A task is a software entity having an associated body of program code which is executed whenever program control within the process is vested in that task. As execution within the process proceeds, program control, i.e., control of the computer, passes among the various tasks and whenever program control passes from a task, its so-called "context"--which defines the execution state of the task at that moment--is saved. Thus each task within a process comprises an "independent thread of control" whose execution can be resumed at any time by restoring its context to the central processing unit (CPU) of the computer.
The order in which the tasks execute may be controlled, for example, by scheduling those of the tasks which are "runnable," i.e., ready to run, at any given time in accordance with priorities preassigned to the tasks. Whenever a task is "activated," i.e., made runnable, it is placed in a queue associated with its priority level, and whenever execution of the currently running task, i.e., the one having program control, is suspended, control is passed--illustratively by a so-called task dispatcher--to the first task in the nonempty queue having the highest priority.
Among the advantages of having a tasking capability is that it allows a software system to be designed with a great degree of modularity and permits the various functions performed within the system to be executed quite independently of one another. In particular, tasking greatly simplifies program design and coding because changes can be made in one part of a software system with little, if any effect, on any other part and because execution of the various functions to be performed is only required to be synchronized at specific points specified by the programmer. These are important considerations in the design of large software systems.
A further advantage of tasking is that a process does not necessarily have to suspend its execution when a particular activity within the process must be suspended to, for example, wait for an I/O or other operation to be completed. Rather, the process can suspend the particular task that needs to wait for that operation and then continue executing by picking up the thread, i.e., continuing execution, of any one or more tasks that are then runnable. This approach not only speeds up program execution within the process, but helps to minimize the frequency with which control of the CPU is switched from one process to the next, which is a time-consuming operation. Indeed, tasking is particularly advantageous in data communication-oriented systems because such systems engender a substantial number of I/O and other wait-inducing operations.
The present invention is particularly useful in systems in which system-supplied software, structured into tasks, provides various services to the user software--hereinafter referred to as the process-specific image--via, for example, user-callable routines, or "primitives." In such arrangements, it is desirable to have a way of integrating execution of the process-specific image with that of the system-supplied software. It is, for example, desirable to have a convenient mechanism for synchronizing the two. It is also desirable for the system-supplied software to be able to take control of a process away from the process-specific image when it needs to, e.g., to expeditiously provide services which the process-specific image has requested.